<%@ page pageEncoding="UTF-8"%>
<html>
<head>
	<title>资源管理</title>
</head>
<body>
	<h3>资源管理</h3>
<div style = "background: url(../images/menuBg.png) repeat fixed; height:420px">
	<form id="form">
		<div class="content_head">
			<label>资源名称</label><input id="queryName" type="text" name="name"/>
			<input type="text" name="test" style="display:none"/>
			<a href="javascript:void(0)" id="querySubmit" onclick="selectResource();" class="commonbtn">查询</a>
			<a href="javascript:void(0)" onclick="openUrl('/user/addResourceView.do');" class="commonbtn">新增</a>
			<a href="javascript:void(0)" onclick="reset();" class="commonbtn">重置查询条件</a>
		</div>
		<table id="datagrid"></table>
	</form>
</div>
<script type="text/javascript">
$(function(){
	$('#datagrid').treegrid({
	    url:'/user/listResource.do',
	    rownumbers:true,
	    treeField:'name',
	    height:330,
	    idField:'id',
	    columns:[[
			{field:'id',title:'操作',width:100,align:'center',formatter: function(value,row,index){
				return "<a href='javascript:void(0)' onclick=\"openUrl('/user/updateResourceView.do?id=" + value + "');\">编辑</a>";
			}},
	        {field:'name',title:'名称',width:150,align:'left'},
	        {field:'url',title:'路径',width:168,align:'left'},
	        {field:'ismenu',title:'是否菜单',width:100},
	        {field:'parentId',title:'父节点',width:100},
	        {field:'posorder',title:'顺序',width:100}	        
	    ]]
	});
	//设置回车提交
	enterSubmit('querySubmit');

});

function selectResource(){
	var name = $("#queryName").val();
	$('#datagrid').treegrid('load', {
		name: name
	});
}
//查询条件清空
function reset(){
	$('#queryName').val("");
}
</script>
</body>
</html>
